package main

import (
	"net"
	"fmt"
)

func main()  {
	//获取本机网卡信息
	ifs,err:=net.Interfaces()
	if err!=nil{
		fmt.Println(err)
	}

	for i,v:=range ifs{
		fmt.Printf("Index: %d,Name: %s,Flags:%d, iindex:%d,MTU:%d,MAC:%s\n",i,v.Name,v.Flags,v.Index,v.MTU,v.HardwareAddr.String())
	}

/*Index: 0,Name: lo,Flags:5, iindex:1,MTU:65536,MAC:
Index: 1,Name: enp3s0,Flags:19, iindex:2,MTU:1500,MAC:08:9e:01:2f:15:96
Index: 2,Name: wlp4s0,Flags:19, iindex:3,MTU:1500,MAC:20:68:9d:19:5d:de
Index: 3,Name: docker0,Flags:19, iindex:4,MTU:1500,MAC:02:42:2a:05:08:cb*/
}
